package com.atguigu.exam;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

/**
 * 利用程序读取 test.txt 文件的内容, 并在控制台打印
 * @author xbd
 * @create 2021-05-30 16:20
 */
public class PrintTxtCTest {
    public static void main(String[] args) {
        BufferedReader br = null;
        try {
            br = new BufferedReader(new FileReader("test1.txt"));
            String str;
            while((str = br.readLine()) != null){
                System.out.println(str);
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if(br != null){
                try {
                    br.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
